<template>
	<view>
		<view v-if='list && list.length > 0'>
			<view v-for='item in list'>
				<view style='margin:5px 10px;border-radius: 5px;' @click='toUrl(item.id)'>
					<img :src='item.image' style='width:100%;height:15vh;border-radius:5px' />
				</view>
			</view>
		</view>
		<view v-else>
			<u-empty mode="list" text='暂无可兑换礼品'>
			</u-empty>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: []
			}
		},
		onLoad() {
			this.request.get(`api/coupons`,{
				'@filter': `entity.getRequirePoints() > 0 && entity.getEnabled() == true`
			}).then((res) => {
				console.log(res.data)
				if(res.data && res.data.length > 0){
					this.list = res.data
				}
			})
		},
		methods: {
			toUrl(id){
				uni.navigateTo({
					url: `/pages/index/coupon-rob?scene=${id}`
				})
			}
		}
	}
</script>

<style>


</style>